package io.github.veigara.tcp.framework.model;

import lombok.Getter;

/**
 * 设备服务器配置
 */
@Getter
public class DeviceServerConfig {
    private final int port;
    private final DeviceType deviceType;
    private final Class<?> decoderClass;
    private final Class<?> encoderClass;
    private final NettyConfig nettyConfig;
    // 长度解析器配置参数
    private final LengthDecodeConfig lengthDecodeConfig;


    // 构造函数 - 用于带长度解析器的配置
    public DeviceServerConfig(
            int port,
            DeviceType deviceType,
            Class<?> decoderClass,
            Class<?> encoderClass,
            NettyConfig nettyConfig,
            LengthDecodeConfig lengthDecodeConfig
    ) {
        this.port = port;
        this.deviceType = deviceType;
        this.decoderClass = decoderClass;
        this.encoderClass = encoderClass;
        this.nettyConfig = nettyConfig;
        this.lengthDecodeConfig = lengthDecodeConfig;

    }

    // 构造函数 - 用于不带长度解析器的配置
    public DeviceServerConfig(
            int port,
            DeviceType deviceType,
            Class<?> decoderClass,
            Class<?> encoderClass,
            NettyConfig nettyConfig
            ) {
        this.port = port;
        this.deviceType = deviceType;
        this.decoderClass = decoderClass;
        this.encoderClass = encoderClass;
        this.nettyConfig = nettyConfig;
        this.lengthDecodeConfig = new LengthDecodeConfig();
    }
}
